﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Algorithm.Offer_Easy_09_CQueue
{
    class MainProject
    {
        static void Main(string[] args)
        {
            //Console.WriteLine(TimeRequiredToBuy(new int[] { 84, 49, 5, 24, 70, 77, 87, 8 }, 3));
            Console.ReadKey();
        }
        public class CQueue
        {
            private Stack<int> m_Stacl_1 = new Stack<int>();
            private Stack<int> m_Stacl_2 = new Stack<int>();
            public CQueue()
            {

            }

            public void AppendTail(int value)
            {
                m_Stacl_1.Push(value);
            }

            public int DeleteHead()
            {
                m_Stacl_2.Clear();
                foreach (var item in m_Stacl_1) m_Stacl_2.Push(item);

                if (m_Stacl_2.Count > 0)
                {
                    int res = m_Stacl_2.Pop(); ;
                    m_Stacl_1.Clear();
                    foreach (var item in m_Stacl_2) m_Stacl_1.Push(item);
                    return res;
                } 
                else return -1;
            }
        }
    }
}
